package com.luych.toolbox.base.service.entity;

import com.luych.toolbox.common.enums.TaskStatus;
import com.luych.toolbox.common.enums.TaskType;
import com.luych.toolbox.common.service.base.BaseEntity;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "task")
public class Task extends BaseEntity {

    @Column(name = "name")
    private String name;
    @Column(name = "type")
    @Enumerated(EnumType.STRING)
    private TaskType type;
    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private TaskStatus status;
    @Column(name = "priority")
    private Integer priority;
    @Column(name = "resource_id")
    private String resourceId;
    @Column(name = "description")
    private String description;
    @Column(name = "stdin")
    private String stdin;
    @Column(name = "stdout")
    private String stdout;
    @Column(name = "start_date")
    private Date startDate;
    @Column(name = "finish_date")
    private Date finishDate;
    @Column(name = "start_long")
    private Long startLong;
    @Column(name = "finish_long")
    private Long finishLong;
    @Column(name = "cost")
    private Long cost;
    @Column(name = "owner_id")
    private String ownerId;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public TaskType getType() {
        return type;
    }

    public void setType(TaskType type) {
        this.type = type;
    }

    public TaskStatus getStatus() {
        return status;
    }

    public void setStatus(TaskStatus status) {
        this.status = status;
        this.priority = status == null ? null : status.getPriority();
    }

    public Integer getPriority() {
        return priority;
    }

    public String getResourceId() {
        return resourceId;
    }

    public void setResourceId(String resourceId) {
        this.resourceId = resourceId;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getStdin() {
        return stdin;
    }

    public void setStdin(String stdin) {
        this.stdin = stdin;
    }

    public String getStdout() {
        return stdout;
    }

    public void setStdout(String stdout) {
        this.stdout = stdout;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getFinishDate() {
        return finishDate;
    }

    public void setFinishDate(Date finishDate) {
        this.finishDate = finishDate;
    }

    public Long getStartLong() {
        return startLong;
    }

    public void setStartLong(Long startLong) {
        this.startLong = startLong;
    }

    public Long getFinishLong() {
        return finishLong;
    }

    public void setFinishLong(Long finishLong) {
        this.finishLong = finishLong;
    }

    public Long getCost() {
        return cost;
    }

    public void setCost(Long cost) {
        this.cost = cost;
    }

    public String getOwnerId() {
        return ownerId;
    }

    public void setOwnerId(String ownerId) {
        this.ownerId = ownerId;
    }
}